<template>
  <div>
    <van-field label='手机号' v-model='mobile'/>
    <van-button @click='send'>发送验证码</van-button>
    <van-field label='验证码' v-model='code'/>
    <van-button @click="login">登录</van-button>
  </div>
</template>

<script>
export default {
  name: "login",
  data() {
    return {
      mobile: '',
      code: ''
    }
  },

  methods: {
    send() {
      this.axios.post('sendSms', {'mobile': this.mobile}).then(res => {
        alert(res.data.mes)
      })
    },
    login() {
      this.axios.post('tlogin', {'mobile': this.mobile, 'code': this.code}).then(res => {
        alert(res.data.meslist)
      })
    }

  },

  mounted() {

  }
}
</script>

<style scoped>

</style>
